import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import store from '@/store/index'
import Pagination from '@/components/pagination';
import {Button,Loading,MessageBox} from 'element-ui';
import VueLazyload from 'vue-lazyload'
import atm from '@/assets/1.gif';
import '@/plugins/validate'
//图片懒加载
Vue.use(VueLazyload,{
  loading:atm
})
//element-ui注册msgbox
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.use(Button)
//mock模拟一些假数据
import'@/mock/mockServer'

import 'swiper/dist/css/swiper.css'
//引入所有接口
import * as API from '@/api/index'
Vue.config.productionTip = false
Vue.component(TypeNav.name,TypeNav)
Vue.component(Carousel.name,Carousel)
Vue.component(Pagination.name,Pagination)

new Vue({
  render: h => h(App),
  beforeCreate(){
      Vue.prototype.$bus=this
      //把所有接口挂载到Vue原型上,这样所有组件不需要引入即可通过$API使用.
      Vue.prototype.$API=API
  },
  router,store
}).$mount('#app')
